app.controller("brandController",function($scope,$controller,$http,brandService){
	$controller('baseController',{$scope:$scope});//继承

			$scope.findAll=function(){
				brandService.findAll().success(
					function(response){
						$scope.list=response;
					}	
				);	
			}

			$scope.findPage=function(page,size){
				brandService.findPage(page,size).success(
					function(response){
						$scope.list=response.rows;
						$scope.paginationConf.totalItems=response.total;
					}	
				)	
			}
			
			$scope.save=function(){
				var serviceObject; //服务层对象
				if($scope.entity.id!=null){
					brandObject=brandService.update($scope.entity);
				}else{
					brandObject=brandService.add($scope.entity);
				}
				serviceObject.success(
					function(response){
						if(response.success){
							$scope.reloadList();
						}else{
							alert(response.message);
						}
					}		
				
				)
			}
			
			$scope.findOne=function(id){
				brandService.findOne().success(
					function(response){
						$scope.entity=response;
					}		
				)
			}
			
			$scope.dele=function(){
				brandService.dele($scope.selectIds).success(
					function(response){
						if(response.success){
							$scope.reloadList();
							$scope.selectIds=[];
						}
					}	
				);
			}
			
			$scope.searchEntity={}
			$scope.search = function(page,size){
				brandService.search(page,size,$scope.searchEntity).success(
					function(response){
						$scope.list=response.rows;
						$scope.paginationConf.totalItems=response.total;
					}	
				)
			}
			
			

		});